<template>
    <div class="page-container">
        <el-row>
            <el-form :inline="true" :model="formData" label-width="80px" label-position="left">
                <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="5">
                    <el-form-item label="日志级别">
                        <standardized-select v-model="formData.logLevel" code-name="sex"></standardized-select>
                    </el-form-item>
                </el-col>
                <el-col :xs="12" :sm="8" :md="8" :lg="6" :xl="5">
                    <el-form-item label="日志类型">
                        <standardized-select v-model="formData.logType" code-name="sex"></standardized-select>
                    </el-form-item>
                </el-col>
                <el-col :xs="12" :sm="12" :md="8" :lg="6" :xl="5">
                    <el-form-item>
                        <el-button type="primary" icon="el-icon-search" @click="clickForm()">查询</el-button>
                        <el-button type="primary" icon="el-icon-refresh-right" >重置</el-button>
                    </el-form-item>
                </el-col>
            </el-form>
        </el-row>
        <el-row>
            <standardized-table url="/log/logs/example/pageable" ref="standardizedTable" :config="configuration"></standardized-table>
        </el-row>
    </div>
</template>

<script>

    import standardizedTable from "../../../components/table/standardizedTable";
    import standardizedSelect from "../../../components/select/standardizedSelect";

    export default {
        name: "logManager",
        components: {standardizedSelect, standardizedTable},
        data(){
            // 构建table
            let tableColumnInfo = [];
            tableColumnInfo.push(new this.$entity.TableColumnConfiguration("logId", "主键"));
            tableColumnInfo.push(new this.$entity.TableColumnConfiguration("logContent", "日志内容"));
            tableColumnInfo.push(new this.$entity.TableColumnConfiguration("logLevel", "日志级别", true, {'error':'danger','debugger':'success'}));
            tableColumnInfo.push(new this.$entity.TableColumnConfiguration("logType", "日志类型"));
            tableColumnInfo.push(new this.$entity.TableColumnConfiguration("remark", "备注"));
            let configuration = new this.$entity.TableConfiguration({tableColumnsInfo: tableColumnInfo});
            return{
              configuration: configuration,
              formData: {
                  logLevel: "",
                  logType: ""
              },
          }
        },
        methods: {
            clickForm(){
                let param = {
                    logLevel: this.formData.logLevel,
                    logType: this.formData.logType
                };
                this.$refs.standardizedTable.loadTableData(param);
            }
        },
    }
</script>

<style lang="stylus" scoped>
</style>